# 公共组件库配置（作为主工程的子目录）

# 收集公共组件源文件
file(GLOB_RECURSE COMMON_SOURCES
    "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc"
)

# 显示找到的源文件
message(STATUS "Common component sources: ${COMMON_SOURCES}")

# 创建公共组件静态库
add_library(common_component STATIC ${COMMON_SOURCES})

# 设置包含目录
target_include_directories(common_component PUBLIC
    ${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(common_component PUBLIC logger)
# 如果需要链接其他库
# target_link_libraries(common_component PUBLIC logger_static)

# 设置编译标准
set_property(TARGET common_component PROPERTY CXX_STANDARD 17)
set_property(TARGET common_component PROPERTY CXX_STANDARD_REQUIRED ON)

# 编译选项
if(MSVC)
    target_compile_options(common_component PRIVATE /W4)
else()
    target_compile_options(common_component PRIVATE -Wall -Wextra)
endif()
